﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Global.Class.Library;

namespace DataTransferObject
{

    public class GCGBCommandMaster : NotifyPropertyChangeObject
    {

        private int gcgbCommandID;

        private string gcgbCommandReference;
        private string description;
        
        private int gcgbCommandTypeID;

        private int preparedEmployeeID;
        private int approvedEmployeeID;

        private DateTime gcgbCommandDate;
        private DateTime entryDate;

        private string remarks;




        public GCGBCommandMaster()
        {
            GlobalDefaultValue.Apply(this);

            this.GCGBCommandDate = DateTime.Today;
            this.EntryDate = DateTime.Today;
        }

        #region Properties


        [DefaultValue(-1)]
        public int GCGBCommandID
        {
            get { return this.gcgbCommandID; }
            set { ApplyPropertyChange<GCGBCommandMaster, int>(ref this.gcgbCommandID, o => o.GCGBCommandID, value); }
        }


        [DefaultValue("")]
        public string GCGBCommandReference
        {
            get { return this.gcgbCommandReference; }
            set { ApplyPropertyChange<GCGBCommandMaster, string>(ref this.gcgbCommandReference, o => o.GCGBCommandReference, value); }
        }


        [DefaultValue("")]
        public string Description
        {
            get { return this.description; }
            set { ApplyPropertyChange<GCGBCommandMaster, string>(ref this.description, o => o.Description, value); }
        }



        [DefaultValue("")]
        public string Remarks
        {
            get { return this.remarks; }
            set { ApplyPropertyChange<GCGBCommandMaster, string>(ref this.remarks, o => o.Remarks, value); }
        }

        
        

        [DefaultValue(0)]
        public int GCGBCommandTypeID
        {
            get { return this.gcgbCommandTypeID; }
            set { ApplyPropertyChange<GCGBCommandMaster, int>(ref this.gcgbCommandTypeID, o => o.GCGBCommandTypeID, value); }
        }

        [DefaultValue(0)]
        public int PreparedEmployeeID
        {
            get { return this.preparedEmployeeID; }
            set { ApplyPropertyChange<GCGBCommandMaster, int>(ref this.preparedEmployeeID, o => o.PreparedEmployeeID, value); }
        }


        [DefaultValue(0)]
        public int ApprovedEmployeeID
        {
            get { return this.approvedEmployeeID; }
            set { ApplyPropertyChange<GCGBCommandMaster, int>(ref this.approvedEmployeeID, o => o.ApprovedEmployeeID, value); }
        }


        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime GCGBCommandDate
        {
            get { return this.gcgbCommandDate; }
            set { ApplyPropertyChange<GCGBCommandMaster, DateTime>(ref this.gcgbCommandDate, o => o.GCGBCommandDate, value); }
        }

        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime EntryDate
        {
            get { return this.entryDate; }
            set { ApplyPropertyChange<GCGBCommandMaster, DateTime>(ref this.entryDate, o => o.EntryDate, value); }
        }



        
        #endregion

        protected override System.Collections.Generic.List<ValidationRule> CreateRules()
        {
            List<ValidationRule> validationRules = base.CreateRules();
            validationRules.Add(new SimpleValidationRule("GCGBCommandReference", "Reference cannot be blank.", delegate { return this.GCGBCommandReference.Length != 0; }));
            validationRules.Add(new SimpleValidationRule("GCGBCommandDate", "Please input date.", delegate { return this.GCGBCommandDate != null; }));
            validationRules.Add(new SimpleValidationRule("GCGBCommandTypeID", "Command type cannot be empty.", delegate { return this.GCGBCommandTypeID > 0; }));
            validationRules.Add(new SimpleValidationRule("PreparedEmployeeID", "Prepared Person cannot be empty.", delegate { return this.PreparedEmployeeID > 0; }));
            validationRules.Add(new SimpleValidationRule("ApprovedEmployeeID", "Approved Person cannot be empty.", delegate { return this.ApprovedEmployeeID > 0; }));
            
            return validationRules;
        }
    }
}
